package webBeans;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import beansInterfaces.BasicProductMgr;


import beansInterfaces.UserMgr;
import dto.ExcursionDTO;



@ManagedBean(name="excursion")
@RequestScoped
public class ExcursionCreationBean 
{
	@EJB
	private BasicProductMgr basicProductMgr;
	@EJB
	private UserMgr u;

	
	
	private ExcursionDTO currentExcursion;
	
	public ExcursionCreationBean() {}
	

	
	public void createExcursion() 
	{	
		this.currentExcursion.setAdmin(u.getUserDTO().getUsername());
		this.basicProductMgr.addExcursion(currentExcursion);
		this.currentExcursion= new ExcursionDTO();
	}



	public ExcursionDTO getCurrentExcursion() {
		return currentExcursion;
	}

	public void setCurrentExcursion(ExcursionDTO currentExcursion) {
		this.currentExcursion = currentExcursion;
	}
	
	
	

	@PostConstruct
	public void initializeCurrent()
	{
		this.currentExcursion = new ExcursionDTO();
	}
	


}

